package com.in.mobilerechargedth.adapter;

import java.util.List;


import com.in.mobilerechargedth.R;
import com.in.mobilerechargedth.model.FirstScreenModel;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class FirstScreenListViewAdapter extends BaseAdapter {

	List<FirstScreenModel> details;
	private LayoutInflater mInflater;

	public FirstScreenListViewAdapter(Context context, List<FirstScreenModel> details) {
		super();
		this.details = details;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return details.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return details.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return details.get(arg0).getOperatorId();
	}

	@Override
	public View getView(int arg0, View v, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ViewHolder viewHolder = null;
		FirstScreenModel detail = details.get(arg0);

		if (v == null) {
			v = mInflater.inflate(R.layout.adapter_item_first_screen, null);
			viewHolder = new ViewHolder();
            viewHolder.operator_name = (TextView) v.findViewById(R.id.txtOperatorName);

			v.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) v.getTag();
		}

		viewHolder.operator_name.setText(detail.geOperatorName());

		return v;
	}

	private class ViewHolder {
	    TextView operator_name;
	}
}
